package es.itpyme.websip.domain;

import java.io.Serializable;
import javax.persistence.*;

/**
 * The primary key class for the USUARIOS_VERSION database table.
 * 
 */
@Embeddable
public class UsuariosVersionPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="VERSION")
	private Version version;

	@ManyToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="USUARIO")
	private Usuario usuario;
	
    public UsuariosVersionPK() {
    }
	

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof UsuariosVersionPK)) {
			return false;
		}
		UsuariosVersionPK castOther = (UsuariosVersionPK)other;
		return 
			(this.usuario == castOther.usuario)
			&& (this.version == castOther.version);

    }
    
	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + ((int) (this.usuario.getId() ^ (this.usuario.getId() >>> 32)));
		hash = hash * prime + ((int) (this.version.getId() ^ (this.version.getId() >>> 32)));
		
		return hash;
    }
}